from django.db import models


class User(models.Model):
    """用户模型"""
    username = models.CharField(max_length=30, null=False)
    create_time = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return '<User(username=%s)>' % self.username


class UserExtension(models.Model):
    """用户拓展信息模型"""
    school = models.CharField(max_length=100, null=False)
    user = models.OneToOneField('User', on_delete=models.CASCADE, related_name='extension')

    def __str__(self):
        return '<UserExtension(school=%s, user_id=%s)>' % (self.school, self.user_id)